package cn.xiaopengstack.domain.strategy.model.valobj;

import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author jiangyangang
 */
@Getter
public enum RuleLogicCheckTypeVO {
    ALLOW("1000", "通过当前规则"),
    TAKE_OVER("1001", "被当前规则接管，不做后续规则校验");


    private final String code;

    private final String info;

    RuleLogicCheckTypeVO(String code, String desc) {
        this.code = code;
        this.info = desc;
    }

    public static RuleLogicCheckTypeVO of(String ruleCheckValue) {

        return Stream.of(RuleLogicCheckTypeVO.values()).filter((typeEnum) -> typeEnum.name().equals(ruleCheckValue)).findFirst().orElse(null);
    }
}
